﻿<phone:PhoneApplicationPage 
	xmlns:System="clr-namespace:System;assembly=mscorlib"
	xmlns:my="clr-namespace:Microsoft.Phone.Controls.Maps;assembly=Microsoft.Phone.Controls.Maps"  
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
	xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone" 
	xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone" 
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
	xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls" 
	xmlns:models="clr-namespace:uottawatourguide.Models"
	x:Class="uottawatourguide.MainPage"
	d:DesignWidth="480" d:DesignHeight="800"
	FontFamily="{StaticResource PhoneFontFamilyNormal}"
	mc:Ignorable="d"
	d:DataContext="{d:DesignData sampledata.xaml}"
	FontSize="{StaticResource PhoneFontSizeNormal}"
	Foreground="{StaticResource PhoneForegroundBrush}"
	SupportedOrientations="Portrait" Orientation="Portrait"
	shell:SystemTray.IsVisible="False">
 
	<!--LayoutRoot is the root grid where all page content is placed-->
	<Grid x:Name="LayoutRoot" Background="Transparent">
		<controls:Panorama Name="pano" Title="U of O tour guide" Margin="12,0,-12,0">
			<controls:Panorama.Background>
				<ImageBrush ImageSource="images\panoramabackground.png" Opacity="0.5" />
			</controls:Panorama.Background>
			<controls:PanoramaItem x:Name="choseTourItem" Header="Chose a tour">
				<!--Double line list with text wrapping-->
				<ListBox Name="toursListBox" Margin="0,0,-12,0" ItemsSource="{Binding Items}" DataContext="{Binding}" SelectionChanged="ListBox_SelectionChanged">
					<ListBox.ItemTemplate>
						<DataTemplate>
							<StackPanel Orientation="Horizontal" Margin="0,0,0,17">
								<Image Height="100" Width="100" Source="{Binding ThumbNailURI}"/>
								<StackPanel Width="311">
									<TextBlock Text="{Binding Title}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}"/>
									<TextBlock Text="{Binding Description}" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextNormalStyle}"/>
								</StackPanel>
							</StackPanel>
						</DataTemplate>
					</ListBox.ItemTemplate>
				</ListBox>			
			</controls:PanoramaItem>
			
			<controls:PanoramaItem x:Name="mapItem" Header="The route" Orientation="Horizontal">
				<Grid>
					<my:Map Name="map" Mode="AerialWithLabels"
							CredentialsProvider="{Binding CredentialsProvider}"
							CopyrightVisibility="Collapsed" LogoVisibility="Collapsed"
							ZoomLevel="{Binding Zoom, Mode=TwoWay}"
							Center="{Binding Center, Mode=TwoWay}" Margin="0,0,-1,0" Width="421" />
                    <Popup x:Name="PushpinPopup" IsOpen="False" Canvas.Top="330" Canvas.Left="45" Opacity="0" Width="440" HorizontalAlignment="Left" Margin="28,308,0,-6">
                        <ListBox x:Name="ListBoxPushpinCatalog" Width="392" Height="56" Background="{StaticResource ControlBackgroundBrush}" ItemsSource="{Binding Items}" SelectionChanged="ListBoxPushpinCatalog_SelectionChanged" DataContext="{Binding}">
                            <ListBox.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <StackPanel Orientation="Horizontal" />
                                </ItemsPanelTemplate>
                            </ListBox.ItemsPanel>
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <Image Width="56" Height="56" Source="{Binding Icon}" />
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>
                    </Popup>

                    <!-- Visual States -->
					<VisualStateManager.VisualStateGroups>
						<VisualStateGroup x:Name="RouteStates">
							<VisualStateGroup.Transitions>
								<VisualTransition To="ShowRoute" />
								<VisualTransition To="HideRoute" />
							</VisualStateGroup.Transitions>
							<VisualState x:Name="ShowRoute">
								<Storyboard>
									<DoubleAnimation Duration="0:0:0.3" To="0" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)" Storyboard.TargetName="RouteView" d:IsOptimized="True">
										<DoubleAnimation.EasingFunction>
											<CircleEase EasingMode="EaseIn" />
										</DoubleAnimation.EasingFunction>
									</DoubleAnimation>
								</Storyboard>
							</VisualState>
							<VisualState x:Name="HideRoute">
								<Storyboard>
									<DoubleAnimation Duration="0:0:0.3" To="-160" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)" Storyboard.TargetName="RouteView" d:IsOptimized="True">
										<DoubleAnimation.EasingFunction>
											<CircleEase EasingMode="EaseOut" />
										</DoubleAnimation.EasingFunction>
									</DoubleAnimation>
								</Storyboard>
							</VisualState>
						</VisualStateGroup>
						<VisualStateGroup x:Name="DirectionsStates">
							<VisualStateGroup.Transitions>
								<VisualTransition To="ShowDirections" />
								<VisualTransition To="HideDirections" />
							</VisualStateGroup.Transitions>
							<VisualState x:Name="ShowDirections">
								<Storyboard>
									<DoubleAnimation Duration="0:0:0.3" To="0" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)" Storyboard.TargetName="DirectionsView" d:IsOptimized="True">
										<DoubleAnimation.EasingFunction>
											<CircleEase EasingMode="EaseIn" />
										</DoubleAnimation.EasingFunction>
									</DoubleAnimation>
									<DoubleAnimation Duration="0:0:0.3" To="428" Storyboard.TargetProperty="Height" Storyboard.TargetName="MapView" d:IsOptimized="True">
										<DoubleAnimation.EasingFunction>
											<CircleEase EasingMode="EaseIn" />
										</DoubleAnimation.EasingFunction>
									</DoubleAnimation>
								</Storyboard>
							</VisualState>
							<VisualState x:Name="HideDirections">
								<Storyboard>
									<DoubleAnimation Duration="0:0:0.3" To="340" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)" Storyboard.TargetName="DirectionsView" d:IsOptimized="True">
										<DoubleAnimation.EasingFunction>
											<CircleEase EasingMode="EaseOut" />
										</DoubleAnimation.EasingFunction>
									</DoubleAnimation>
									<DoubleAnimation Duration="0:0:0.3" To="768" Storyboard.TargetProperty="Height" Storyboard.TargetName="MapView" d:IsOptimized="True">
										<DoubleAnimation.EasingFunction>
											<CircleEase EasingMode="EaseOut" />
										</DoubleAnimation.EasingFunction>
									</DoubleAnimation>
								</Storyboard>
							</VisualState>
						</VisualStateGroup>
						<VisualStateGroup x:Name="PushpinsStates">
							<VisualStateGroup.Transitions>
								<VisualTransition To="ShowPushpins" />
								<VisualTransition To="HidePushpins" />
							</VisualStateGroup.Transitions>
							<VisualState x:Name="ShowPushpins">
								<Storyboard>
									<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Popup.IsOpen)" Storyboard.TargetName="PushpinPopup">
										<DiscreteObjectKeyFrame KeyTime="0">
											<DiscreteObjectKeyFrame.Value>
												<System:Boolean>True</System:Boolean>
											</DiscreteObjectKeyFrame.Value>
										</DiscreteObjectKeyFrame>
									</ObjectAnimationUsingKeyFrames>
									<DoubleAnimation Duration="0:0:0.3" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PushpinPopup" d:IsOptimized="True">
										<DoubleAnimation.EasingFunction>
											<CircleEase EasingMode="EaseIn" />
										</DoubleAnimation.EasingFunction>
									</DoubleAnimation>
								</Storyboard>
							</VisualState>
							<VisualState x:Name="HidePushpins">
								<Storyboard>
									<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Popup.IsOpen)" Storyboard.TargetName="PushpinPopup">
										<DiscreteObjectKeyFrame KeyTime="0">
											<DiscreteObjectKeyFrame.Value>
												<System:Boolean>False</System:Boolean>
											</DiscreteObjectKeyFrame.Value>
										</DiscreteObjectKeyFrame>
									</ObjectAnimationUsingKeyFrames>
									<DoubleAnimation Duration="0:0:0.3" To="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PushpinPopup" d:IsOptimized="True">
										<DoubleAnimation.EasingFunction>
											<CircleEase EasingMode="EaseOut" />
										</DoubleAnimation.EasingFunction>
									</DoubleAnimation>
								</Storyboard>
							</VisualState>
						</VisualStateGroup>
					</VisualStateManager.VisualStateGroups>
				</Grid>
			</controls:PanoramaItem>
            <controls:PanoramaItem x:Name="nextStopItem" Header="About">
                <TextBlock Height="520" HorizontalAlignment="Left" Margin="0,0,0,0" Name="currentStopInfo" Text="{Binding Description}" VerticalAlignment="Top" Width="456" DataContext="{Binding}" />
            </controls:PanoramaItem>
        </controls:Panorama>
        
    </Grid>
</phone:PhoneApplicationPage>